package com.study.ssm.annotation02.config;

import com.study.ssm.annotation02.injection.UserDAO;
import com.study.ssm.annotation02.injection.UserDAOImpl;
import com.study.ssm.annotation02.injection.UserService;
import com.study.ssm.annotation02.injection.UserServiceImpl;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;

import javax.annotation.Resource;

/**
 * @author zhoujunlin
 * @date 2023年07月27日 10:13
 * @desc
 */
@Configuration
@ComponentScan(basePackages = "com.study.ssm.annotation02.injection")
public class AppConfig3 {

    @Resource
    private UserDAO userDAO;

    @Bean
    public UserService userService() {
        UserServiceImpl userService = new UserServiceImpl();
        userService.setUserDAO(userDAO);
        return userService;
    }

}
